package com.example.finaltool.utils;

import com.example.finaltool.model.db.SysCorpVillage;
import com.example.finaltool.model.CunDepInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author dengbw
 * @date 2021/8/9 3:37 下午
 */
public class SysCorpVillageUtils {

    private SysCorpVillageUtils(){}

    public static SysCorpVillage newXiangzhen(Long subId, String corpId) {
        return new SysCorpVillage(corpId, subId, "乡镇管理人员", true, false, true);
    }
    public static SysCorpVillage newFuwu(Long subId, String corpId) {
        return new SysCorpVillage(corpId, subId, "服务支撑人员", true, true, false);
    }

    public static List<SysCorpVillage> newCunList(List<CunDepInfo> cunList, String corpId, Map<String, String> areaIdMap) {
        List<SysCorpVillage> res = new ArrayList<>(cunList.size());
        cunList.forEach(c -> res.add(new SysCorpVillage(corpId, c.getCunDepId(), c.getCunName(), true, false, false, areaIdMap.get(c.getCunName()))));
        return res;
    }
}
